package com.sgb.goods.api;


import com.sgb.goods.entity.AppointEntity;
import com.sgb.goods.entity.AttributeViewEntity;
import com.sgb.goods.entity.BrandEntity;
import com.sgb.goods.entity.BrandManagerEntity;
import com.sgb.goods.entity.CommonStAttrEntity;
import com.sgb.goods.entity.ContractInfoEntity;
import com.sgb.goods.entity.ContractStateEntity;
import com.sgb.goods.entity.DictEntity;
import com.sgb.goods.entity.GoodsManageListEntity;
import com.sgb.goods.entity.GoodsUnitEntity;
import com.sgb.goods.entity.InvoiceDetailsEntity;
import com.sgb.goods.entity.LogisticsDetailEntity;
import com.sgb.goods.entity.MenuEntity1;
import com.sgb.goods.entity.OrderDetailsEntity;
import com.sgb.goods.entity.OrderDynamicEntity;
import com.sgb.goods.entity.OrderListEntity;
import com.sgb.goods.entity.OrderNoticeEntity;
import com.sgb.goods.entity.ProListEntity;
import com.sgb.goods.entity.ReceiptGoodsDelEntity;
import com.sgb.goods.entity.ShopMyPriceListEntity;
import com.sgb.goods.entity.StorageManageEntity;
import com.sgb.goods.entity.TradingContractEntity;
import com.sgb.goods.entity.inquiry.MapLongAndLatEntity;
import com.sgb.goods.entity.order.LogisticsAgreementEntity;
import com.sgb.goods.entity.order.OrderPayInfoEntity;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.base.model.entity.H5ReEntity;
import com.swgk.core.base.model.entity.ListResponse;
import com.swgk.core.view.areapopup.AddressEntity;

import java.util.List;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * 合同API
 *
 * @author cyj
 */
public interface GoodsApi {

    /**
     * 获取审批配置
     *
     * @param type
     * @param companyNo
     * @return
     */
    @GET("v1/app/user/order/checkApprovalConfig")
    Call<BaseEntity<String>> getApprovalConfig(@Query("type") String type, @Query("companyNo") String companyNo);

    /**
     * 获取订单列表
     *
     * @param orderProcessState 审批单查询 固定传1，其他查询都传空,示例值(1)
     * @param page
     * @param limit
     * @param type              1采购订单 2销售订单,示例值(1)
     * @param orderState        订单状态（待接单 0 待签收 10 待支付 101 待发货102 已发货103 已完成7 已取消 8 ）,示例值(0)
     * @return
     */
    @GET("v1/app/user/order/list")
    Call<BaseEntity<ListResponse<List<OrderListEntity>>>> getOrdersList(@Query("orderProcessState") String orderProcessState,
                                                                        @Query("page") int page, @Query("limit") int limit, @Query("type") String type, @Query("orderState") String orderState);

    /**
     * 查询合同信息
     *
     * @param map
     * @return
     */
    @POST("v1/app/user/order/findContractPage")
    Call<BaseEntity<ContractInfoEntity>> getContractList(@Body Map<String, Object> map);

    /***
     * 获取物流信息详情
     * @param orderId
     * @return
     */
    @GET("v1/app/user/order/getDeliverByOrderId")
    Call<BaseEntity<List<LogisticsDetailEntity.Record>>> getDeliverByOrderId(@Query("orderId") String orderId);

    /**
     * 获取订单详情
     *
     * @param orderId
     * @return
     */
    @GET("v1/app/user/order/findOrderById")
    Call<BaseEntity<OrderDetailsEntity>> getOrderDetail(@Query("orderId") String orderId, @Query("type") String orderType);

    /***
     * 获取交易发票信息
     * @param orderId
     * @return
     */
    @GET("v1/app/user/order/viewInvoice")
    Call<BaseEntity<InvoiceDetailsEntity>> getTradingContractContent(@Query("orderId") String orderId);

    /***
     * 根据 orderId查询约定信息
     * @return
     */
    @GET("v1/app/user/order/findAppoint")
    Call<BaseEntity<List<AppointEntity>>> findAppoint(@Query("orderId") String orderId);

    /**
     * @param orderId 查询付款约定
     * @return
     */
    @GET("v1/app/user/order/payAppointList")
    Call<BaseEntity<List<com.sgb.goods.entity.order.OrderPayDetailEntity>>> getPayAppointList(@Query("orderId") String orderId);

    /**
     * 采购订单--采购商要求
     *
     * @param orderId 订单id
     * @return
     */
    @GET("v1/app/user/order/otherInfo")
    Call<BaseEntity<TradingContractEntity>> getOtherInfo(@Query("orderId") String orderId);

    /***
     * 根据 companyNo查询合同列表
     * @return
     */
    @POST("v1/app/user/order/findContractPage")
    Call<BaseEntity<ContractInfoEntity>> findContractPage(@Body Map map);

    /**
     * 查询合同动态
     *
     * @param orderNo
     * @param companyNo
     * @return
     */
    @GET("v1/app/user/order/findContractState")
    Call<BaseEntity<ContractStateEntity>> getContractState(@Query("orderNo") String orderNo, @Query("companyNo") String companyNo);

    /**
     * 查询订单动态
     *
     * @param map
     * @return
     */
    @POST("v1/app/user/order/findDynamic")
    Call<BaseEntity<OrderDynamicEntity>> getOrderDynamicInfo(@Body Map<String, Object> map);

    /***
     * 获取订单 该当前用户操作的 提示信息
     * @param orderId 订单id
     * @param type    预留参数 判断 采购详情提示1 销售详情提示2
     * @return
     */
    @GET("v1/app/user/order/getNotice")
    Call<BaseEntity<OrderNoticeEntity>> getNotice(@Query("orderId") String orderId, @Query("type") String type);

    /**
     * 采购订单--收货详情
     *
     * @param receiveId
     * @return
     */
    @GET("v1/app/user/order/receiveDetails")
    Call<BaseEntity<ReceiptGoodsDelEntity>> getReceiveDetails(@Query("receiveId") String receiveId);

    /***
     * 获取订单付款详情
     * @param orderId
     * @param type  1:采购；2：销售
     * @param way   1:列表支付列表；2:详情里的收款信息
     * @return
     */
    @GET("v1/app/user/order/findOrderPayDetailList")
    Call<BaseEntity<OrderPayInfoEntity>> getListPayDetails(@Query("orderId") String orderId, @Query("type") String type, @Query("way") String way);

    /**
     * 仓储列表
     * 我的-商品经营-仓储管理、商品发布
     *
     * @param pageNum
     * @param pageSize
     * @param storageName 根据查询仓储名称查询
     * @return
     */
    @FormUrlEncoded
    @POST("v1/app/management/shop/getStorageList")
    Call<BaseEntity<ProListEntity<List<StorageManageEntity>>>> getStorageList(@Field("pageNum") int pageNum, @Field("pageSize") int pageSize, @Field("text") String storageName);

    /**
     * 删除仓储信息
     * 我的-商品经营-仓储管理
     *
     * @param id 仓储信息id
     * @return
     */
    @HTTP(method = "DELETE", path = "v1/app/management/shop/deleteStorage/{id}", hasBody = true)
    Call<BaseEntity<Object>> deleteWareHousing(@Path("id") String id);

    /**
     * 品牌列表
     *
     * @param pageNum
     * @param pageSize
     * @param companyId
     * @return
     */
    @FormUrlEncoded
    @POST("v1/app/management/shop/getBrandList")
    Call<BaseEntity<ProListEntity<List<BrandManagerEntity>>>> getBrandList(@Field("pageNum") int pageNum, @Field("pageSize") int pageSize, @Field("companyId") String companyId);

    /**
     * 删除品牌
     *
     * @param id
     * @return
     */
    @HTTP(method = "DELETE", path = "v1/app/management/shop/deleteBrand/{id}", hasBody = true)
    Call<BaseEntity<Object>> deleteBrand(@Path("id") String id);

    /**
     * 品牌保存
     *
     * @param map
     * @return
     */
    @POST("v1/app/management/shop/saveBrand")
    Call<BaseEntity<Object>> saveBrand(@Body Map map);

    /**
     * 商品经营-我的报价
     *
     * @param status
     * @param page
     * @param limit
     * @param purchaserName
     * @return
     */
    @GET("v1/app/user/goods/quote/myQuoteList")
    Call<BaseEntity<ListResponse<List<ShopMyPriceListEntity>>>> getPriceShop(@Query("status") int status, @Query("page") int page, @Query("limit") int limit, @Query("purchaserName") String purchaserName);

    /**
     * 订单详情  H5
     *
     * @param param
     * @return
     */
    @GET("v1/app/common/getUrlSetting")
    Call<BaseEntity<H5ReEntity>> getUrlSetting(@Query("param") String param);

    /**
     * 获取三级地址列表
     *
     * @return
     */
    @GET("common/simpleArea.json")
    Call<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> getCityList();

    /**
     * 保存或修改仓储信息
     * 我的-商品经营-仓储管理
     *
     * @param entity 仓储信息对象
     * @return
     */
    @POST("v1/app/management/shop/saveStorage")
    Call<BaseEntity<Object>> saveStorage(@Body StorageManageEntity entity);

    /**
     * 获取地址经纬度
     *
     * @param areaCode
     * @param provinceNo
     * @param cityNo
     * @param districtNo
     * @return
     */
    @POST("v1/app/logistics/getAddressCoordinate")
    Call<BaseEntity<MapLongAndLatEntity>> getLocationLL(@Query("areaCode") String areaCode, @Query("provinceNo") String provinceNo, @Query("cityNo") String cityNo, @Query("districtNo") String districtNo);

    /**
     * 商品单位列表
     *
     * @param text
     * @return
     */
    @FormUrlEncoded
    @POST("v1/app/user/goods/unitList")
    Call<BaseEntity<List<GoodsUnitEntity>>> unitList(@Field("text") String text);

    /**
     * 供应商 根据分类id 获取商品品牌
     *
     * @param id
     * @param text 品牌名称
     * @return
     */
    @FormUrlEncoded
    @POST("v1/app/user/goods/brandList")
    Call<BaseEntity<List<BrandEntity>>> brandList(@Field("cid") String id, @Field("text") String text);

    /**
     * 商品分类
     *
     * @return
     */
    @POST("v1/app/user/goods/goodsCategory")
    Call<BaseEntity<List<MenuEntity1<MenuEntity1<MenuEntity1>>>>> goodsCategory();

    /**
     * 获取商砼属性接口
     *
     * @return
     */
    @POST("v1/app/user/goods/concreteAttrs")
    Call<BaseEntity<List<CommonStAttrEntity>>> getStAttribute();

    /**
     * 获取商品属性接口
     *
     * @param id
     * @return
     */
    @GET("v1/app/material/buyer/materChoose")
    Call<BaseEntity<List<AttributeViewEntity>>> getAttribute(@Query("id") String id);

    /**
     * 物流约定
     *
     * @param orderId
     * @return
     */
    @GET("v1/app/user/order/LogisticsAppointList")
    Call<BaseEntity<List<LogisticsAgreementEntity>>> getLogisticsAgreement(@Query("orderId") String orderId);

    /**
     * 商品管理列表
     *
     * @param map
     * @return
     */
    @POST("v1/app/user/goods/myGoodsList")
    Call<BaseEntity<ListResponse<List<GoodsManageListEntity>>>> myGoodsList(@Body Map map);

    /**
     * 商品状态分类
     *
     * @return
     */
    @GET("v1/app/user/goods/goodsStatusCategory")
    Call<BaseEntity<List<DictEntity>>> goodsStatusCategory();

    /**
     * 商品上架-下架
     *
     * @return
     */
    @POST("v1/app/user/goods/upDown")
    Call<BaseEntity<Object>> upDown(@Body Map map);
}
